<cfsilent>
	<cfset email = "" />
	<cfif structKeyExists(cookie,'c63') and cookie.c63 neq "">
		<cfset email = $.format.decrypt(cookie.c63) />
	</cfif>

	<cfif structKEyExists(url,"email") and url.email neq "">
		<cfset email = url.email />
	</cfif>
	
	<cfset unsubscribe = $.request.getValue("unsubscribe") />
	<cfset message = $.request.getValue("message") />
	<cfset outcome = $.request.getValue("outcome") />
	<cfset userID = $.request.getValue("activate") />
	<cfif userID neq "">
		<cfset $.run.it('craftivityController.activateAccount',{userID=userID}) />
	</cfif>
	<cfset userCount = $.run.it('craftivityService.getUserCount') />
	<cfset code = $.request.getValue('code') />
	
	<cfif unsubscribe neq "">
		<cfset $.run.it('craftivityService.removeFromBetaList',{email=unsubscribe}) />
		<cfset message="You've been removed from the waiting list." />
	</cfif>
</cfsilent>

<cfoutput>
	<style>
		input{
			height:25px;
			padding:0px 3px;
			display:inline-block;
			width:95px;
			font-size:12px;
			background-color:white;
			border-radius:2px;
			box-shadow: inset 0 1px 2px rgba(0,0,0,.1);
			margin:4px 2px;
		}
		form{
			width:280px;
			margin:auto;
			background-color:white;
			margin-top:5%;
			border-radius:3px;
			box-shadow:3px 3px 10px rgb(170, 170, 170);
			padding:20px 10px;
		}
		div.row{
			margin:4px;
		}
		button{
			width:30px;
			display:inline-block;
			text-transform:uppercase;
			background-color:##E96F70;
			border-bottom:3px solid ##dd4749;
			padding:2px 3px;
			color:white;
			box-shadow:2px 2px 5px rgb(170, 170, 170);
		}
		button:hover{
			background-color:##FA5152;
		}
		.message{
			color:##666666;
			font-size:15px;
			margin:3px;
			padding:2px 10px;
		}
	</style>
	<script>
		$(document).ready(function(){
			var dst = Main.getClientDST();
			var timezone = Main.getClientTimezone();
			$('[name=timezone]').val(timezone);
			$('[name=dst]').val(dst);
		});
	</script>
	<cfif application.userLimit - userCount.counts gt 0>
		<form method="POST" name="create_form" id="create_form" action="#$.link.form(cfc='craftivityController',method='createAccount')#">
			<img src="/craftivity/assets/landingPage/logo-beta.png" alt="Craftivity" style="margin-bottom:10px;"/> 
			<div style="color:##666666;">
				#application.userLimit - userCount.counts# spots remaining<i class="fa fa-info-circle" style="font-size:14px;cursor:help;" title="We're monitoring server load to make sure&##013;everyone has a good experience.&##013;&##013;More spots will be added on a regular basis."></i>
			</div>
			<cfif outcome eq "success">
				<div class="message">
					Thanks for signing up!
				</div>
				<div class="message">
					An email will be sent to
				</div>
				<div class="message">
					<b>#email#</b>
				</div>
				<div class="message">
					with an activation link for <span style="color:rgb(218, 36, 36);font-weight:bold;">Craftivity</span>!
				</div>
			<cfelse>
				<cfif message neq "">
					<div class="message">
						#message#
					</div>
				</cfif>
				<div class="row">
					<input class="formInputs" validate="required,email,maxLength100" placeholder="Your Email" name="email" value="#email#" type="email" style="width:115px;" />
					<input class="formInputs" validate="required,minLength6,maxLength100" placeholder="Your Password" name="password" type="password" value="" <cfif email neq ''>autofocus</cfif> style="width:75px;" />
				</div>
				<div class="row">
					<input class="formInputs" validate="required,maxLength100" placeholder="First Name" name="first_name" value="" type="text" />
					<input class="formInputs" validate="required,maxLength100" placeholder="Last Name" name="last_name" value="" type="text" />
				</div>
				<div class="row">
					<input class="formInputs" validate="required" name="code" value="beproductive" type="hidden" />
					<button name="form_submit" type="submit" style="width:62px;margin-top:7px;">Sign Up</button>
				</div>
				<div>
					<a href="#$.site.getVar('rootURL')#/login.cfm">already signed up?</a>
				</div>
				
				<input name="timezone" value="" type="hidden" />
				<input name="dst" value="" type="hidden" />
			</cfif>
		</form>
	<cfelse>
	
		<!--- NO MORE SPOTS --->
		
		<form method="POST" name="create_form" id="create_form" action="#$.link.form(cfc='craftivityController',method='signupBetaAccess')#">
			<img src="/craftivity/assets/landingPage/logo-beta.png" alt="Craftivity" style="margin-bottom:10px;"/> 

			<cfif message neq "">
				<div class="message">
					#message#
				</div>
				<div>
					<a href="#$.site.getVar('rootURL')#/beta_signup.cfm">Enter another email?</a>
				</div>
			<cfelse>
				<div style="color:##666666;">
					Sorry, we've hit our signup limit for now.<i class="fa fa-info-circle" style="font-size:14px;cursor:help;" title="We're monitoring server load to make sure&##013;everyone has a good experience.&##013;&##013;More spots will be added on a regular basis."></i>
				</div></br></br>
				<div style="color:##666666;margin:6px;">
					Want to be notified when openings are added?
				</div>
				<div class="row">
					<input class="formInputs" validate="required,email,maxLength200" placeholder="Your Email" name="email" value="#email#" type="email" style="width:115px;" />
					<button name="form_submit" type="submit" style="width:62px;margin-top:7px;">Sign Up</button>
				</div>
				<div>
					<a href="#$.site.getVar('rootURL')#/login.cfm">already signed up?</a>
				</div>
			</cfif>
		</form>
	</cfif>
</cfoutput>
						